package com.example.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author zhanglei
 * RefreshScope注解，实时获取配置变更
 */
@RefreshScope
@RestController
@RequestMapping("/user")
public class UserController {

    @Value("${student.name}")
    private String name;
    @Value("${student.age}")
    private String age;

    @GetMapping("/get")
    public String get() {

        return "name=" + name + ",age=" + age;
    }

}
